package lab1;

public class Computer{
	private String Computercpuname = "";
	private String Computerdiskname = "";
	private String Computermainboardname = "";
	private String Computermemoryname = "";
	private String Computername = "";
	private int totalprice = 0;
	
	public Computer(String Computername, String cpuname, String memoryname, String diskname, String mainboardname)
	{
		this.Computername = Computername;
		
		if(cpuname.equals ("Intel"))
		{
			Intel Intel = new Intel();
			this.Computercpuname = Intel.getname();
			totalprice += Intel.getprice();		
		}
		else
		{
			AMD AMD = new AMD();
			this.Computercpuname = AMD.getname();
			totalprice += AMD.getprice();
		}
		
		if(memoryname.equals("Samsung"))
		{
			Samsung Samsung = new Samsung();
			this.Computerdiskname = Samsung.getname();
			totalprice += Samsung.getprice();
		}
		else
		{
			Kingston Kingston = new Kingston();
			this.Computerdiskname = Kingston.getname();
			totalprice += Kingston.getprice();
		}
		
		if(diskname.equals("Seagate"))
		{
			Seagate Seagate = new Seagate();
			this.Computermainboardname = Seagate.getname();
			totalprice += Seagate.getprice();
		}
		else
		{
			WestDigitals WestDigitals = new WestDigitals();
			this.Computermainboardname = WestDigitals.getname();
			totalprice += WestDigitals.getprice();
		}
		
		if(mainboardname.equals("Asus"))
		{
			Asus Asus = new Asus();
			this.Computermemoryname = Asus.getname();
			totalprice += Asus.getprice();
		}
		else
		{
			Gigabyte Gigabyte = new Gigabyte();
			this.Computermemoryname = Gigabyte.getname();
			totalprice += Gigabyte.getprice();
		}	
	}
	
	public void showinfo()
	{
		System.out.println(this.Computername);
		System.out.println("cpu " + this.Computercpuname);
		System.out.println("memory" + this.Computermemoryname);
		System.out.println("disk" + this.Computerdiskname);
		System.out.println("mainboard" + this.Computermainboardname);
		System.out.println("totalprice" + this.totalprice);
		System.out.println();
	}
    
}
